package com.cms.recursoshumanos.engine;

import net.rim.device.api.system.Display;
import net.rim.device.api.ui.Font;
import net.rim.device.api.ui.Ui;

public class FontEngine 
{
	private boolean isHighDPI;
	
	private int pointsSmallHDPI = 4;
	private int pointsSmallLDPI = 5;
	
	private int pointsMediumHDPI = 6;
	private int pointsMediumLDPI = 6;
	
	private int pointsLargeHDPI = 7;
	private int pointsLargeLDPI = 8;
	
	private int pointsExtraLargeHDPI = 10;
	private int pointsExtraLargeLDPI = 11;

	private static FontEngine instance;
	
	
	public static FontEngine getInstance()
	{
	   	if(instance == null)
	   	{
	   		instance = new FontEngine();
	   	}
	   	return instance;
	}
	    
	private FontEngine()
	{
	    isHighDPI = Display.getVerticalResolution() > 8000;
//	    Log.log("FontEngine", "VerticalResolution " + Display.getVerticalResolution());
	}
	
	public Font getSmallFont(int style)
	{
    	return isHighDPI ?  Font.getDefault().derive(style, pointsSmallHDPI,Ui.UNITS_pt) :  Font.getDefault().derive(style, pointsSmallLDPI,Ui.UNITS_pt);
    }
    	
    public Font getMediumFont(int style)
	{
		return isHighDPI ?  Font.getDefault().derive(style, pointsMediumHDPI,Ui.UNITS_pt) :  Font.getDefault().derive(style,pointsMediumLDPI,Ui.UNITS_pt);
    }
        
    public Font getLargeFont(int style)
	{
    	return isHighDPI ?  Font.getDefault().derive(style, pointsLargeHDPI,Ui.UNITS_pt) :  Font.getDefault().derive(style, pointsLargeLDPI,Ui.UNITS_pt);
    }
    
    public Font getExtraLargeFont(int style)
	{
    	return isHighDPI ?  Font.getDefault().derive(style, pointsExtraLargeHDPI,Ui.UNITS_pt) :  Font.getDefault().derive(style, pointsExtraLargeLDPI,Ui.UNITS_pt);
    }

    
    public Font getPeliculaFont(int style)
	{
		return isHighDPI ?  Font.getDefault().derive(style, pointsMediumHDPI,Ui.UNITS_pt) :  Font.getDefault().derive(style,pointsMediumLDPI,Ui.UNITS_pt);
    }

}

